package com.corejava.training.collections.car.pre15;

import java.util.*;

public class TelevisionMutableDemo {

	
	public static void main(String[] args) {

		// instantiate televisionmutable class and create instances of the class
		// and set values for fields
		TelevisionMutable tv1 = new TelevisionMutable();
		tv1.setCompany("Sony");
		tv1.setType("LCD");
		tv1.setThreedenabled(false);
		tv1.setPrice(299.99);
		
		TelevisionMutable tv2 = new TelevisionMutable();
		tv2.setCompany("Samsung");
		tv2.setType("LED");
		tv2.setThreedenabled(true);
		tv2.setPrice(399.99);
		
		TelevisionMutable tv3 = new TelevisionMutable();
		tv3.setCompany("Hitachi");
		tv3.setType("Plasma");
		tv3.setThreedenabled(true);
		tv3.setPrice(599.99);
		
		// create List and add tv objects to List
		List tvs = new ArrayList();
		tvs.add(tv1);
		tvs.add(tv2);
		tvs.add(tv3);
		
		// read objects from the list and print out with java 1.4 style
		Iterator ite = tvs.iterator();
		while(ite.hasNext()){
			TelevisionMutable tvm = (TelevisionMutable)ite.next();
			System.out.println("Company: " + tvm.getCompany());
			System.out.println("Type: " + tvm.getType());
			System.out.println("3D enabled: " + tvm.isThreedenabled());
			System.out.println("Price: " + tvm.getPrice());
			System.out.println("--------------------------------");
			
			
		}
		
		
	}

}
